package com.soft.cake.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.soft.cake.mapper.OrderMapper;
import com.soft.cake.pojo.Order;
import com.soft.cake.service.IOrderService;

@Service
public class OrderServiceImpl implements IOrderService {
	
	@Autowired
	private OrderMapper orderMapper;
	
	/**
	 * @author Qijuan Liu
	 * @description 通过userID获取订单列表
	 * @param userId
	 * @return List<Order>
	 */
	public List<Order> listOrders(int userId) {
		List<Order> orders=orderMapper.selectAllOrderByUserId(userId);
		return orders;
	}

	
	@Override
	
	public Order selOrder(Integer orderId) {
		// TODO Auto-generated method stub
		return orderMapper.selOrderWithProListByOrderId(orderId);
	}
	
	/**
	 * @author Qijuan Liu
	 * @description 通过orderID获取一个订单详情
	 * 
	 */
	public Order order(int orderId) {
		Order order=orderMapper.selectOrderByOrderId(orderId);
		return order;
	}
	
	

}
